package com.goldsprite.gdxcore.serializations;

import java.io.*;

import com.badlogic.gdx.Gdx;
import java.util.Map;
import org.yaml.snakeyaml.Yaml;

public class YamlStorage {

    public static void saveYaml(Map<String, Object> data, String filename) {
        try {
            Yaml yaml = new Yaml();
            FileWriter writer = new FileWriter(Gdx.files.local(filename).file());
            yaml.dump(data, writer);
            writer.close();
        } catch (IOException e) {
            e.printStackTrace();
        }
    }

    public static Map<String, Object> loadYaml(String filename) {
        Yaml yaml = new Yaml();
        return yaml.load(Gdx.files.local(filename).reader());
    }
}

